<? 
	$accesslevel=1;
	$title="My Profiles";
	require("required/dbconnect.php");
	require("required/share_function.php");
	$_SESSION['pid']=-1;
	require("required/header.php"); 
	
	require("required/chkuser.php");
	$getdata=mysql_query("select * from os_member where id=".$member_id);
	$a=mysql_fetch_array($getdata,MYSQL_ASSOC);
	
	
?>
<script src="required/js/jquery-1.4.2.min.js"></script>
<script src="required/js/common_javascript.js"></script>
<?
	
	
	if(!empty($_GET['updated'])){
		$updated=$_GET['updated'];
		
		switch($updated){
			case 1:
				$msg="<div class='dw_success'>Record Updated</div>";
				break;
			case 3:
				$msg="<div class='dw_success'>Stock Updated</div>";
				break;
			case 4:
				$msg="<div class='dw_success'>Image Deleted</div>";
				break;	
			default:
				$msg="unknown";
				break;
		}
		echo "<script>displayMsg('divMsg')</script>";	
	}else{
		$msg="";
	}
?>
			<table width="100%" cellpadding="6" cellspacing="0">
					<td align="left" class="page_title_bar" width="100%">
					 My profile
					</td>
				<tr>
					<td align="center">
						<table width="90%" height="100%" >
							<tr>
                                <td colspan="3"> <div id="divMsg"><?= $msg ?></div></td>
                            </tr>
							<tr>
								<td height="20" colspan="3"><strong>Account</strong></td>
							</tr>
							<tr valign="top">
                            <td>Email</td><td>:</td><td><?= $a['email'] ?> [<a href="os_editemail.php"><u>Change</u></a>]</td>
                            </tr>
                            <tr valign="top">
                                <td width="12%">Password</td><td width="1%">:</td><td width="52%">****** [<a href="os_changepassword.php">Change</a>]</td>
                            </tr>	
							
                         
								
							<tr>
								<td height="20" colspan="3"><br><br><strong>Personal Information</strong></td>
							</tr>
							<tr>
								<td>First Name</td><td>:</td><td><?= $a['name'] ?></td>
							</tr>
                            <tr>
								<td>Last Name</td><td>:</td><td><?= $a['last_name'] ?></td>
							</tr>
							<?
								if($a['gender']=="male")
								{
									$sex="Male";
								}
								else
								{
									$sex="Female";
								}
							?>
							<tr>
								<td>Gender</td><td>:</td><td><?= $sex ?></td>
							</tr>
							<tr>
								<td>Birth date</td><td>:</td><td><?= $a['dob'] ?></td>
							</tr>
							<tr>
								<td>IC number</td><td>:</td><td><?= $a['icnumber'] ?></td>
							</tr>
							<tr>
							<td height="20" colspan="3"><br><br>	<strong>Contact information</strong></td>
							</tr>
							<?
									if($a['state']!=0)
									{
									
										$get_place=mysql_query("select * from os_state where id=".$a['state'])or die(mysql_error());
										$place=mysql_result($get_place,0,"name_eng");
										$state="$place";
									}
									else
									{
										$state="-";
									}
									
									if($a['country']!=0)
									{
									
										$get_country=mysql_query("select * from os_country where id=".$a['country'])or die(mysql_error());
										$country=mysql_result($get_country,0,"engname");
										$word_country="$country";
										if(mysql_result($get_country,0,'area_type')=="")
										{
											$area_type="State";
										}else{
											$area_type=mysql_result($get_country,0,'area_type');
										}
									}
									else
									{
										$word_country="other";
										$area_type="State";
									} 
									
							?>
							<tr>
								<td>Country</td><td>:</td><td>
								<?= $word_country ?>
								</td>
							</tr>
							
							<tr>
								<td><?= $area_type ?></td><td>:</td><td><?= $state ?></td>
							</tr>
							<tr>
								<td>Address</td><td>:</td><td><?= $a['address1'] ?></td>
							</tr>
							<tr>
								<td colspan="2"></td><td><?= $a['address2'] ?></td>
							</tr>
							<tr>
								<td>Postcode</td><td>:</td><td><?= $a['postcode'] ?></td>
							</tr>
							<tr>
								<td>City</td><td>:</td><td><?= $a['city'] ?></td>
							</tr>
							<tr>
								<td>Contact number</td><td>:</td><td><?= $a['hpnumber'] ?><br></td>
							</tr>
							<tr>
								<td>Fax</td><td>:</td><td><?= $a['fax'] ?><br></td>
							</tr>
							<form method="post" action="os_editdetails.php">
							<tr>
								<td colspan="3" align="center">
								<input type="hidden" name="id" value="<?= $member_id ?>">
								<input type="submit" value="Edit Profile" class="button">
								</td>
							</tr>	
							</form>
						</table>
					</td>
				</tr>
		  </table>

<? require("required/footer.php"); ?>